.class public Lcom/netease/newsreader/util/CollectPicturesAdapter;
.super Landroid/widget/BaseAdapter;
.source "CollectPicturesAdapter.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;
    }
.end annotation


# instance fields
.field private allCheckStatus:Z

.field private app:Lcom/netease/newsreader/activity/MyApplication;

.field private db:Landroid/database/sqlite/SQLiteDatabase;

.field private mContext:Landroid/content/Context;

.field private mGlobal:Landroid/widget/CheckBox;

.field private mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

.field private mInflater:Landroid/view/LayoutInflater;

.field private mIsSee:Z

.field private mList:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/Object;",
            ">;>;"
        }
    .end annotation
.end field

.field private mSelectNum:I


# direct methods
.method public constructor <init>(Landroid/content/Context;Ljava/util/List;ZLandroid/widget/CheckBox;)V
    .locals 4
    .parameter "context"
    .parameter
    .parameter "isSee"
    .parameter "global"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/content/Context;",
            "Ljava/util/List",
            "<",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/Object;",
            ">;>;Z",
            "Landroid/widget/CheckBox;",
            ")V"
        }
    .end annotation

    .prologue
    .line 47
    .local p2, list:Ljava/util/List;,"Ljava/util/List<Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;>;"
    invoke-direct {p0}, Landroid/widget/BaseAdapter;-><init>()V

    .line 32
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    .line 48
    iput-object p1, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mContext:Landroid/content/Context;

    .line 49
    iput-object p2, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mList:Ljava/util/List;

    .line 50
    iput-boolean p3, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mIsSee:Z

    .line 51
    iput-object p4, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mGlobal:Landroid/widget/CheckBox;

    .line 52
    iget-object v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    check-cast v0, Lcom/netease/newsreader/activity/MyApplication;

    iput-object v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->app:Lcom/netease/newsreader/activity/MyApplication;

    .line 53
    iget-object v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->app:Lcom/netease/newsreader/activity/MyApplication;

    invoke-virtual {v0}, Lcom/netease/newsreader/activity/MyApplication;->getSQLiteDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    iput-object v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->db:Landroid/database/sqlite/SQLiteDatabase;

    .line 54
    new-instance v1, Lcom/netease/newsreader/util/BaseImageDownloader;

    iget-object v2, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mContext:Landroid/content/Context;

    iget-object v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const v3, 0x7f0200cf

    invoke-virtual {v0, v3}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    check-cast v0, Landroid/graphics/drawable/BitmapDrawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/BitmapDrawable;->getBitmap()Landroid/graphics/Bitmap;

    move-result-object v0

    invoke-direct {v1, v2, v0}, Lcom/netease/newsreader/util/BaseImageDownloader;-><init>(Landroid/content/Context;Landroid/graphics/Bitmap;)V

    iput-object v1, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    .line 55
    const-string v0, "layout_inflater"

    invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/view/LayoutInflater;

    iput-object v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mInflater:Landroid/view/LayoutInflater;

    .line 56
    return-void
.end method

.method static synthetic access$0(Lcom/netease/newsreader/util/CollectPicturesAdapter;)I
    .locals 1
    .parameter

    .prologue
    .line 37
    iget v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mSelectNum:I

    return v0
.end method

.method static synthetic access$1(Lcom/netease/newsreader/util/CollectPicturesAdapter;I)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 37
    iput p1, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mSelectNum:I

    return-void
.end method

.method static synthetic access$2(Lcom/netease/newsreader/util/CollectPicturesAdapter;)Landroid/database/sqlite/SQLiteDatabase;
    .locals 1
    .parameter

    .prologue
    .line 30
    iget-object v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->db:Landroid/database/sqlite/SQLiteDatabase;

    return-object v0
.end method

.method static synthetic access$3(Lcom/netease/newsreader/util/CollectPicturesAdapter;)Landroid/widget/CheckBox;
    .locals 1
    .parameter

    .prologue
    .line 34
    iget-object v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mGlobal:Landroid/widget/CheckBox;

    return-object v0
.end method

.method static synthetic access$4(Lcom/netease/newsreader/util/CollectPicturesAdapter;Z)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 36
    iput-boolean p1, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->allCheckStatus:Z

    return-void
.end method


# virtual methods
.method public getCount()I
    .locals 1

    .prologue
    .line 62
    iget-object v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mList:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    return v0
.end method

.method public getItem(I)Ljava/lang/Object;
    .locals 1
    .parameter "position"

    .prologue
    .line 68
    const/4 v0, 0x0

    return-object v0
.end method

.method public getItemId(I)J
    .locals 2
    .parameter "position"

    .prologue
    .line 74
    int-to-long v0, p1

    return-wide v0
.end method

.method public getSelectNums()I
    .locals 1

    .prologue
    .line 190
    iget v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mSelectNum:I

    return v0
.end method

.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 16
    .parameter "position"
    .parameter "convertView"
    .parameter "parent"

    .prologue
    .line 88
    if-nez p2, :cond_1

    .line 89
    new-instance v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;

    const/4 v1, 0x0

    move-object/from16 v0, p0

    invoke-direct {v11, v0, v1}, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;-><init>(Lcom/netease/newsreader/util/CollectPicturesAdapter;Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;)V

    .line 91
    .local v11, holder:Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;
    move-object/from16 v0, p0

    iget-object v1, v0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mInflater:Landroid/view/LayoutInflater;

    const v3, 0x7f03000e

    const/4 v4, 0x0

    invoke-virtual {v1, v3, v4}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object p2

    .line 92
    const v1, 0x7f0c004e

    move-object/from16 v0, p2

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/ImageView;

    iput-object v1, v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;->appImage:Landroid/widget/ImageView;

    .line 93
    const v1, 0x7f0c004f

    move-object/from16 v0, p2

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/TextView;

    iput-object v1, v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;->appName:Landroid/widget/TextView;

    .line 94
    const v1, 0x7f0c0050

    move-object/from16 v0, p2

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/CheckBox;

    iput-object v1, v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;->appcb:Landroid/widget/CheckBox;

    .line 96
    move-object/from16 v0, p2

    invoke-virtual {v0, v11}, Landroid/view/View;->setTag(Ljava/lang/Object;)V

    .line 101
    :goto_0
    new-instance v12, Ljava/util/HashMap;

    invoke-direct {v12}, Ljava/util/HashMap;-><init>()V

    .line 102
    .local v12, map:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    move-object/from16 v0, p0

    iget-object v1, v0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mList:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v1

    if-lez v1, :cond_0

    .line 103
    move-object/from16 v0, p0

    iget-object v1, v0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mList:Ljava/util/List;

    move/from16 v0, p1

    invoke-interface {v1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v12

    .end local v12           #map:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    check-cast v12, Ljava/util/Map;

    .line 105
    .restart local v12       #map:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    :cond_0
    const-string v1, "collect_title"

    invoke-interface {v12, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v13

    .line 106
    .local v13, o:Ljava/lang/Object;
    if-nez v13, :cond_2

    const-string v15, ""

    .line 107
    .local v15, sTitle:Ljava/lang/String;
    :goto_1
    const-string v1, "auto_id"

    invoke-interface {v12, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v13

    .line 108
    if-nez v13, :cond_3

    const-string v10, ""

    .line 110
    .local v10, deleteId:Ljava/lang/String;
    :goto_2
    const-string v1, "collect_path"

    invoke-interface {v12, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v2

    .line 112
    .local v2, imageUrl:Ljava/lang/String;
    move-object/from16 v0, p0

    iget-object v1, v0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    sget-object v3, Lcom/netease/newsreader/util/BaseImageDownloader$Mode;->CORRECT:Lcom/netease/newsreader/util/BaseImageDownloader$Mode;

    invoke-virtual {v1, v3}, Lcom/netease/newsreader/util/BaseImageDownloader;->setMode(Lcom/netease/newsreader/util/BaseImageDownloader$Mode;)V

    .line 113
    move-object/from16 v0, p0

    iget-object v1, v0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    iget-object v3, v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;->appImage:Landroid/widget/ImageView;

    const/16 v4, 0xaa

    const/16 v5, 0xaa

    const-string v6, "Y"

    move-object/from16 v0, p0

    iget-object v7, v0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mContext:Landroid/content/Context;

    invoke-virtual {v7}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v7

    const v8, 0x7f0200cf

    invoke-virtual {v7, v8}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v7

    check-cast v7, Landroid/graphics/drawable/BitmapDrawable;

    invoke-virtual {v7}, Landroid/graphics/drawable/BitmapDrawable;->getBitmap()Landroid/graphics/Bitmap;

    move-result-object v7

    const-string v8, "picture"

    invoke-virtual/range {v1 .. v8}, Lcom/netease/newsreader/util/BaseImageDownloader;->downloadPictures(Ljava/lang/String;Landroid/widget/ImageView;IILjava/lang/String;Landroid/graphics/Bitmap;Ljava/lang/String;)V

    .line 125
    iget-object v1, v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;->appName:Landroid/widget/TextView;

    invoke-virtual {v1, v15}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 126
    iget-object v1, v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;->appcb:Landroid/widget/CheckBox;

    invoke-virtual {v1, v10}, Landroid/widget/CheckBox;->setTag(Ljava/lang/Object;)V

    .line 127
    move-object/from16 v0, p0

    iget-boolean v1, v0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mIsSee:Z

    if-eqz v1, :cond_4

    .line 128
    iget-object v1, v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;->appcb:Landroid/widget/CheckBox;

    const/4 v3, 0x4

    invoke-virtual {v1, v3}, Landroid/widget/CheckBox;->setVisibility(I)V

    .line 177
    :goto_3
    return-object p2

    .line 98
    .end local v2           #imageUrl:Ljava/lang/String;
    .end local v10           #deleteId:Ljava/lang/String;
    .end local v11           #holder:Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;
    .end local v12           #map:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    .end local v13           #o:Ljava/lang/Object;
    .end local v15           #sTitle:Ljava/lang/String;
    :cond_1
    invoke-virtual/range {p2 .. p2}, Landroid/view/View;->getTag()Ljava/lang/Object;

    move-result-object v11

    check-cast v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;

    .restart local v11       #holder:Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;
    goto/16 :goto_0

    .line 106
    .restart local v12       #map:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    .restart local v13       #o:Ljava/lang/Object;
    :cond_2
    invoke-virtual {v13}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v15

    goto :goto_1

    .line 108
    .restart local v15       #sTitle:Ljava/lang/String;
    :cond_3
    invoke-virtual {v13}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v10

    goto :goto_2

    .line 130
    .restart local v2       #imageUrl:Ljava/lang/String;
    .restart local v10       #deleteId:Ljava/lang/String;
    :cond_4
    iget-object v1, v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;->appcb:Landroid/widget/CheckBox;

    const/4 v3, 0x0

    invoke-virtual {v1, v3}, Landroid/widget/CheckBox;->setVisibility(I)V

    .line 132
    move-object/from16 v0, p0

    iget-boolean v1, v0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->allCheckStatus:Z

    if-eqz v1, :cond_6

    iget-object v1, v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;->appcb:Landroid/widget/CheckBox;

    const/4 v3, 0x1

    invoke-virtual {v1, v3}, Landroid/widget/CheckBox;->setChecked(Z)V

    .line 149
    :cond_5
    :goto_4
    iget-object v1, v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;->appcb:Landroid/widget/CheckBox;

    new-instance v3, Lcom/netease/newsreader/util/CollectPicturesAdapter$1;

    move-object/from16 v0, p0

    invoke-direct {v3, v0, v10}, Lcom/netease/newsreader/util/CollectPicturesAdapter$1;-><init>(Lcom/netease/newsreader/util/CollectPicturesAdapter;Ljava/lang/String;)V

    invoke-virtual {v1, v3}, Landroid/widget/CheckBox;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    goto :goto_3

    .line 135
    :cond_6
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v3, "select * from collect_table where auto_id=\'"

    invoke-direct {v1, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 136
    invoke-virtual {v1, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v3, "\'"

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    .line 135
    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v14

    .line 137
    .local v14, s:Ljava/lang/String;
    move-object/from16 v0, p0

    iget-object v1, v0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->db:Landroid/database/sqlite/SQLiteDatabase;

    const/4 v3, 0x0

    new-array v3, v3, [Ljava/lang/String;

    invoke-virtual {v1, v14, v3}, Landroid/database/sqlite/SQLiteDatabase;->rawQuery(Ljava/lang/String;[Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v9

    .line 138
    .local v9, c:Landroid/database/Cursor;
    if-eqz v9, :cond_7

    invoke-interface {v9}, Landroid/database/Cursor;->getCount()I

    move-result v1

    if-lez v1, :cond_7

    invoke-interface {v9}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v1

    if-eqz v1, :cond_7

    .line 139
    const-string v1, "ischecked"

    invoke-interface {v9, v1}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v1

    invoke-interface {v9, v1}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v1

    if-eqz v1, :cond_7

    .line 140
    const-string v1, "ischecked"

    invoke-interface {v9, v1}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v1

    invoke-interface {v9, v1}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v1

    const-string v3, "1"

    invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_7

    .line 141
    iget-object v1, v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;->appcb:Landroid/widget/CheckBox;

    const/4 v3, 0x1

    invoke-virtual {v1, v3}, Landroid/widget/CheckBox;->setChecked(Z)V

    .line 145
    :goto_5
    if-eqz v9, :cond_5

    invoke-interface {v9}, Landroid/database/Cursor;->close()V

    goto :goto_4

    .line 143
    :cond_7
    iget-object v1, v11, Lcom/netease/newsreader/util/CollectPicturesAdapter$GridHolder;->appcb:Landroid/widget/CheckBox;

    const/4 v3, 0x0

    invoke-virtual {v1, v3}, Landroid/widget/CheckBox;->setChecked(Z)V

    goto :goto_5
.end method

.method public setCheckOrNoAllBox(Z)V
    .locals 1
    .parameter "isChecked"

    .prologue
    .line 181
    iput-boolean p1, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->allCheckStatus:Z

    .line 182
    if-eqz p1, :cond_0

    .line 183
    invoke-virtual {p0}, Lcom/netease/newsreader/util/CollectPicturesAdapter;->getCount()I

    move-result v0

    iput v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mSelectNum:I

    .line 187
    :goto_0
    return-void

    .line 185
    :cond_0
    const/4 v0, 0x0

    iput v0, p0, Lcom/netease/newsreader/util/CollectPicturesAdapter;->mSelectNum:I

    goto :goto_0
.end method
